Skip to content

Re-clustering API bug fixes #2397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 23, 2024
Merged

Re-clustering API bug fixes #2397

merged 5 commits into from
May 23, 2024

Conversation

MohamedElgammal
Copy link
Contributor

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@github-actions github-actions bot added the VPR VPR FPGA Placement & Routing Tool label Sep 16, 2023
@vaughnbetz
Copy link
Contributor

@MohamedElgammal some tests failed due to download issues --> relaunch?
Adding @AlexandreSinger as a potential reviewer.

@@ -157,6 +165,8 @@ bool swap_two_molecules(t_pack_molecule* molecule_1,
bool during_packing,
int verbosity,
t_clustering_data& clustering_data) {
auto& cluster_ctx = g_vpr_ctx.mutable_clustering();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this on Amin's MR, but why is this declared so far away from where it is used? Is this a style thing?

t_pb* clb_pb_1 = cluster_ctx.clb_nlist.block_pb(clb_1);
std::string clb_pb_1_name = (std::string)clb_pb_1->name;
t_pb* clb_pb_2 = cluster_ctx.clb_nlist.block_pb(clb_2);
std::string clb_pb_2_name = (std::string)clb_pb_2->name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also put this on Amins PR lol, but I think these should use the std::string's constructor instead of using the c-style casting

const int mode,
const int feasible_block_array_size,
const int& mode,
const int& feasible_block_array_size,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these made pass by reference? Did you see any performance increase after changing this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing an int by constant reference isn't going to be faster and might be slower as a pointer is 64-bits and an int is 32, and pointer chasing is slow. After compiler optimization the whole pointer/reference stuff might go away, but generally it is better to pass things smaller than or equal to pointer size by value; use const & for bigger things that aren't changed in a function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I suggest putting these back to const int, although it isn't a huge deal.

@vaughnbetz
Copy link
Contributor

@MohamedElgammal : should this PR be landed?
@KA7E may be interested in these fixes.

@AlexandreSinger
Copy link
Contributor

I am also interested in these fixes.

@MohamedElgammal
Copy link
Contributor Author

looking good to me .. We need to have a second look on the failing tests ... let me rerun them and update you

@MohamedElgammal MohamedElgammal added docs Documentation and removed docs Documentation labels May 2, 2024
@github-actions github-actions bot added the lang-cpp C/C++ code label May 2, 2024
@AlexandreSinger
Copy link
Contributor

AlexandreSinger commented May 5, 2024

I think the 4 Clang CI build failures are caused by this branch being behind VTR master by some time. I think rebasing it onto VTR master should resolve the issue. @MohamedElgammal could you rebase the branch? I see a button to do so, but I am not sure if doing it from the GitHub UI would cause any issues.

@AlexandreSinger AlexandreSinger force-pushed the reclustering-api-bug-fixes branch from 4640730 to b95d1e3 Compare May 23, 2024 15:42
@AlexandreSinger
Copy link
Contributor

I have rebased the branch using the GitHub UI. Hopefully the tests should pass now and this can be merged in.

@vaughnbetz
Copy link
Contributor

Great, thanks. @MohamedElgammal : any barrier to merging this if CI passes?

@vaughnbetz
Copy link
Contributor

@AlexandreSinger : I believe this is the branch that has an example of how to use the re-clustering API.
https://github.com/verilog-to-routing/vtr-verilog-to-routing/tree/packing-multithreading
(see pack_utils.cpp)

@MohamedElgammal
Copy link
Contributor Author

@AlexandreSinger : Thanks for rebasing it.
@vaughnbetz : this branch should be good to be merged if it passes (I think it will pass anyway as the API isn't used in the master branch). My plan is to add unit tests for the different use cases of the API functions but never got to this task.

@vaughnbetz
Copy link
Contributor

Thanks Mohamed. Merging!

@vaughnbetz vaughnbetz merged commit 75746eb into master May 23, 2024
103 checks passed
@vaughnbetz vaughnbetz deleted the reclustering-api-bug-fixes branch May 23, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants